home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / biz / ccard11 / config.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1995-01-28  |  17.9 KB  |  639 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, and
  23. # --with-PACKAGE[=VALUE] unless this script has special code to handle it.
  24.  
  25. for arg
  26. do
  27.   # Handle --exec-prefix with a space before the argument.
  28.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  29.   # Handle --host with a space before the argument.
  30.   elif test x$next_host = xyes; then next_host=
  31.   # Handle --prefix with a space before the argument.
  32.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  33.   # Handle --srcdir with a space before the argument.
  34.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  35.   # Handle --only with a space before the argument.
  36.   elif test x$next_only = xyes; then only="--only $arg"; next_only=
  37.   else
  38.     case $arg in
  39.      # For backward compatibility, recognize -exec-prefix and --exec_prefix.
  40.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  41.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  42.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  43.     next_exec_prefix=yes ;;
  44.  
  45.      -gas | --gas | --ga | --g) ;;
  46.  
  47.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  48.      -host | --host | --hos | --ho | --h)
  49.     next_host=yes ;;
  50.  
  51.      -nfp | --nfp | --nf) ;;
  52.  
  53.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  54.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  55.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  56.     next_prefix=yes ;;
  57.  
  58.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  59.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  60.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  61.     next_srcdir=yes ;;
  62.  
  63.      -only=* | --only=* )
  64.     only=`echo $arg | sed 's/[-a-z_]*=//'`
  65.     only="--only $only" ;;
  66.      -only | --only )
  67.     next_only=yes ;;
  68.  
  69.      -no-create | --no-create )
  70.        no_create=yes ;;
  71.  
  72.      -with-* | --with-*)
  73.        package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'`
  74.        # Reject names that aren't valid shell variable names.
  75.        if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  76.          echo "configure: $package: invalid package name" >&2; exit 1
  77.        fi
  78.        package=`echo $package| sed 's/-/_/g'`
  79.        case "$arg" in
  80.          *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
  81.          *) val=1 ;;
  82.        esac
  83.        eval "with_$package='$val'" ;;
  84.  
  85.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  86.        verbose=yes ;;
  87.  
  88.      *) ;;
  89.     esac
  90.   fi
  91. done
  92.  
  93. trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15
  94. trap 'rm -f confdefs*' 0
  95.  
  96. # NLS nuisances.
  97. # These must not be set unconditionally because not all systems understand
  98. # e.g. LANG=C (notably SCO).
  99. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  100. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  101.  
  102. rm -f conftest* confdefs.h
  103. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  104. echo > confdefs.h
  105. compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  106.  
  107. # A filename unique to this package, relative to the directory that
  108. # configure is in, which we can look for to find out if srcdir is correct.
  109. unique_file=patchlevel.h
  110.  
  111. # Find the source files, if location was not specified.
  112. if test -z "$srcdir"; then
  113.   srcdirdefaulted=yes
  114.   # Try the directory containing this script, then `..'.
  115.   prog=$0
  116.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  117.   test "X$confdir" = "X$prog" && confdir=.
  118.   srcdir=$confdir
  119.   if test ! -r $srcdir/$unique_file; then
  120.     srcdir=..
  121.   fi
  122. fi
  123. if test ! -r $srcdir/$unique_file; then
  124.   if test x$srcdirdefaulted = xyes; then
  125.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  126.   else
  127.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  128.   fi
  129.   exit 1
  130. fi
  131. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  132. # But we can't avoid them for `..', to make subdirectories work.
  133. case $srcdir in
  134.   .|/*|~*) ;;
  135.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  136. esac
  137.  
  138.  
  139. # Save the original args to write them into config.status later.
  140. configure_args="$*"
  141.  
  142.  
  143. if test -z "$CC"; then
  144.   # Extract the first word of `gcc', so it can be a program name with args.
  145.   set dummy gcc; word=$2
  146.   echo checking for $word
  147.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  148.   for dir in $PATH; do
  149.     test -z "$dir" && dir=.
  150.     if test -f $dir/$word; then
  151.       CC="gcc"
  152.       break
  153.     fi
  154.   done
  155.   IFS="$saveifs"
  156. fi
  157. test -z "$CC" && CC="cc"
  158. test -n "$CC" && test -n "$verbose" && echo "    setting CC to $CC"
  159.  
  160. # Find out if we are using GNU C, under whatever name.
  161. cat > conftest.c <<EOF
  162. #ifdef __GNUC__
  163.   yes
  164. #endif
  165. EOF
  166. ${CC-cc} -E conftest.c > conftest.out 2>&1
  167. if egrep yes conftest.out >/dev/null 2>&1; then
  168.   GCC=1 # For later tests.
  169. fi
  170. rm -f conftest*
  171.  
  172. echo checking how to run the C preprocessor
  173. if test -z "$CPP"; then
  174.   # This must be in double quotes, not single quotes, because CPP may get
  175.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  176.   # make.  It must be expanded now.
  177.   CPP="${CC-cc} -E"
  178.   cat > conftest.c <<EOF
  179. #include "confdefs.h"
  180. #include <stdio.h>
  181. Syntax Error
  182. EOF
  183. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  184. if test -z "$err"; then
  185.   :
  186. else
  187.   rm -rf conftest*
  188.   CPP=/lib/cpp
  189. fi
  190. rm -f conftest*
  191. fi
  192. test ".${verbose}" != "." && echo "    setting CPP to $CPP"
  193.  
  194.  
  195. if test -z "$GCC" ; then
  196. echo checking for Pyramid
  197. cat > conftest.c <<EOF
  198. #include "confdefs.h"
  199. #ifdef __pyrsoft
  200.   yes
  201. #endif
  202. EOF
  203. eval "$CPP conftest.c > conftest.out 2>&1"
  204. if egrep "yes" conftest.out >/dev/null 2>&1; then
  205.   rm -rf conftest*
  206.   CC="/usr/ccs/bin/cc"
  207. RANLIB="echo no need to ranlib"
  208.  
  209. fi
  210. rm -f conftest*
  211.  
  212. fi
  213.  
  214. # Make sure to not get the incompatible SysV /etc/install and
  215. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  216. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  217. # or the AFS install, which mishandles nonexistent args, or
  218. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  219. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  220. # anyway.  Sigh.
  221. if test "z${INSTALL}" = "z" ; then
  222.   echo checking for install
  223.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  224.   for dir in $PATH; do
  225.     test -z "$dir" && dir=.
  226.     case $dir in
  227.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  228.     *)
  229.       if test -f $dir/installbsd; then
  230.     INSTALL="$dir/installbsd -c" # OSF1
  231.     INSTALL_PROGRAM='$(INSTALL)'
  232.     INSTALL_DATA='$(INSTALL) -m 644'
  233.     break
  234.       fi
  235.       if test -f $dir/install; then
  236.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  237.       : # AIX
  238.     else
  239.       INSTALL="$dir/install -c"
  240.       INSTALL_PROGRAM='$(INSTALL)'
  241.       INSTALL_DATA='$(INSTALL) -m 644'
  242.       break
  243.     fi
  244.       fi
  245.       ;;
  246.     esac
  247.   done
  248.   IFS="$saveifs"
  249. fi
  250. INSTALL=${INSTALL-cp}
  251. test -n "$verbose" && echo "    setting INSTALL to $INSTALL"
  252. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  253. test -n "$verbose" && echo "    setting INSTALL_PROGRAM to $INSTALL_PROGRAM"
  254. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  255. test -n "$verbose" && echo "    setting INSTALL_DATA to $INSTALL_DATA"
  256.  
  257. echo checking for AIX
  258. cat > conftest.c <<EOF
  259. #include "confdefs.h"
  260. #ifdef _AIX
  261.   yes
  262. #endif
  263.  
  264. EOF
  265. eval "$CPP conftest.c > conftest.out 2>&1"
  266. if egrep "yes" conftest.out >/dev/null 2>&1; then
  267.   rm -rf conftest*
  268.   
  269. {
  270. test -n "$verbose" && \
  271. echo "    defining _ALL_SOURCE"
  272. echo "#define" _ALL_SOURCE 1 >> confdefs.h
  273. DEFS="$DEFS -D_ALL_SOURCE=1"
  274. SEDDEFS="${SEDDEFS}\${SEDdA}_ALL_SOURCE\${SEDdB}_ALL_SOURCE\${SEDdC}1\${SEDdD}
  275. \${SEDuA}_ALL_SOURCE\${SEDuB}_ALL_SOURCE\${SEDuC}1\${SEDuD}
  276. \${SEDeA}_ALL_SOURCE\${SEDeB}_ALL_SOURCE\${SEDeC}1\${SEDeD}
  277. "
  278. }
  279.  
  280.  
  281. fi
  282. rm -f conftest*
  283.  
  284.  
  285. echo checking for minix/config.h
  286. cat > conftest.c <<EOF
  287. #include "confdefs.h"
  288. #include <minix/config.h>
  289. EOF
  290. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  291. if test -z "$err"; then
  292.   rm -rf conftest*
  293.   MINIX=1
  294.  
  295. fi
  296. rm -f conftest*
  297.  
  298. # The Minix shell can't assign to the same variable on the same line!
  299. if test -n "$MINIX"; then
  300.   
  301. {
  302. test -n "$verbose" && \
  303. echo "    defining _POSIX_SOURCE"
  304. echo "#define" _POSIX_SOURCE 1 >> confdefs.h
  305. DEFS="$DEFS -D_POSIX_SOURCE=1"
  306. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  307. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  308. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  309. "
  310. }
  311.  
  312.   
  313. {
  314. test -n "$verbose" && \
  315. echo "    defining" _POSIX_1_SOURCE to be 2
  316. echo "#define" _POSIX_1_SOURCE 2 >> confdefs.h
  317. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  318. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_1_SOURCE\${SEDdB}_POSIX_1_SOURCE\${SEDdC}2\${SEDdD}
  319. \${SEDuA}_POSIX_1_SOURCE\${SEDuB}_POSIX_1_SOURCE\${SEDuC}2\${SEDuD}
  320. \${SEDeA}_POSIX_1_SOURCE\${SEDeB}_POSIX_1_SOURCE\${SEDeC}2\${SEDeD}
  321. "
  322. }
  323.  
  324.   
  325. {
  326. test -n "$verbose" && \
  327. echo "    defining _MINIX"
  328. echo "#define" _MINIX 1 >> confdefs.h
  329. DEFS="$DEFS -D_MINIX=1"
  330. SEDDEFS="${SEDDEFS}\${SEDdA}_MINIX\${SEDdB}_MINIX\${SEDdC}1\${SEDdD}
  331. \${SEDuA}_MINIX\${SEDuB}_MINIX\${SEDuC}1\${SEDuD}
  332. \${SEDeA}_MINIX\${SEDeB}_MINIX\${SEDeC}1\${SEDeD}
  333. "
  334. }
  335.  
  336. fi
  337.  
  338. echo checking for POSIXized ISC
  339. if test -d /etc/conf/kconfig.d &&
  340.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  341. then
  342.   ISC=1 # If later tests want to check for ISC.
  343.   
  344. {
  345. test -n "$verbose" && \
  346. echo "    defining _POSIX_SOURCE"
  347. echo "#define" _POSIX_SOURCE 1 >> confdefs.h
  348. DEFS="$DEFS -D_POSIX_SOURCE=1"
  349. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  350. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  351. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  352. "
  353. }
  354.  
  355.   if test -n "$GCC"; then
  356.     CC="$CC -posix"
  357.   else
  358.     CC="$CC -Xp"
  359.   fi
  360. fi
  361.  
  362. LIBS_save="${LIBS}"
  363. LIBS="${LIBS} -lintl"
  364. have_lib=""
  365. echo checking for -lintl
  366. cat > conftest.c <<EOF
  367. #include "confdefs.h"
  368.  
  369. int main() { exit(0); }
  370. int t() { main(); }
  371. EOF
  372. if eval $compile; then
  373.   rm -rf conftest*
  374.   have_lib="1"
  375.  
  376. fi
  377. rm -f conftest*
  378. LIBS="${LIBS_save}"
  379. if test -n "${have_lib}"; then
  380.    :; LIBS="$LIBS -lintl"
  381. else
  382.    :; 
  383. fi
  384.  
  385.  
  386. for hdr in stdlib.h string.h memory.h
  387. do
  388. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  389. echo checking for ${hdr}
  390. cat > conftest.c <<EOF
  391. #include "confdefs.h"
  392. #include <${hdr}>
  393. EOF
  394. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  395. if test -z "$err"; then
  396.   rm -rf conftest*
  397.   
  398. {
  399. test -n "$verbose" && \
  400. echo "    defining ${trhdr}"
  401. echo "#define" ${trhdr} 1 >> confdefs.h
  402. DEFS="$DEFS -D${trhdr}=1"
  403. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  404. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  405. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  406. "
  407. }
  408.  
  409.  
  410. fi
  411. rm -f conftest*
  412. done
  413.  
  414.  
  415. echo checking for a Bourne shell which understands functions
  416. if test "z$SH" = "z"; then
  417.     if test -f /bin/sh5; then
  418.     SH=/bin/sh5
  419.     else
  420.     SH=/bin/sh
  421.     fi
  422. fi
  423.  
  424.  
  425. {
  426. test -n "$verbose" && \
  427. echo "    defining" CONF_SHELL to be \"$SH\"
  428. echo "#define" CONF_SHELL \"$SH\" >> confdefs.h
  429. DEFS="$DEFS -DCONF_SHELL=\"$SH\""
  430. SEDDEFS="${SEDDEFS}\${SEDdA}CONF_SHELL\${SEDdB}CONF_SHELL\${SEDdC}\"$SH\"\${SEDdD}
  431. \${SEDuA}CONF_SHELL\${SEDuB}CONF_SHELL\${SEDuC}\"$SH\"\${SEDuD}
  432. \${SEDeA}CONF_SHELL\${SEDeB}CONF_SHELL\${SEDeC}\"$SH\"\${SEDeD}
  433. "
  434. }
  435.  
  436.  
  437. # Set default prefixes.
  438. if test -n "$prefix"; then
  439.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  440.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  441. fi
  442. if test -n "$exec_prefix"; then
  443.   prsub="$prsub
  444. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  445. fi
  446. # Quote sed substitution magic chars in DEFS.
  447. cat >conftest.def <<EOF
  448. $DEFS
  449. EOF
  450. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  451. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  452. rm -f conftest.def
  453. # Substitute for predefined variables.
  454.  
  455. trap 'rm -f config.status; exit 1' 1 3 15
  456. echo creating config.status
  457. rm -f config.status
  458. cat > config.status <<EOF
  459. #!/bin/sh
  460. # Generated automatically by configure.
  461. # Run this file to recreate the current configuration.
  462. # This directory was configured as follows,
  463. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  464. #
  465. # $0 $configure_args
  466.  
  467. for arg
  468. do
  469.   if test x\$next_only = xyes; then only="\$arg"; next_only=
  470.   else
  471.     case "\$arg" in
  472.       -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  473.       echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args
  474.       exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;;
  475.   
  476.       -only | --only)
  477.       next_only=yes ;;
  478.   
  479.       -only=* | --only=*)
  480.       only=\`echo \$arg | sed 's/[-a-z_]*=//'\` ;;
  481.   
  482.       *)
  483.         echo "Usage: config.status [ --recheck ][ --only filename ]" 1>&2;
  484.     exit 1 ;;
  485.     esac
  486.   fi
  487. done
  488.  
  489. trap 'rm -fr Makefile config.h conftest*; exit 1' 1 3 15
  490. CC='$CC'
  491. CPP='$CPP'
  492. INSTALL='$INSTALL'
  493. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  494. INSTALL_DATA='$INSTALL_DATA'
  495. SH='$SH'
  496. LIBS='$LIBS'
  497. srcdir='$srcdir'
  498. prefix='$prefix'
  499. exec_prefix='$exec_prefix'
  500. prsub='$prsub'
  501. extrasub='$extrasub'
  502. EOF
  503. cat >> config.status <<\EOF
  504.  
  505. top_srcdir=$srcdir
  506.  
  507. CONFIG_FILES=${CONFIG_FILES-"Makefile"}
  508. for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
  509.   if test "x$only" != "x" -a "x$only" != "x$file"; then continue; fi
  510.   srcdir=$top_srcdir
  511.   # Remove last slash and all that follows it.  Not all systems have dirname.
  512.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  513.   if test "$dir" != "$file"; then
  514.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  515.     test ! -d $dir && mkdir $dir
  516.   fi
  517.   echo creating $file
  518.   rm -f $file
  519.   test "$file" = Makefile && \
  520.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  521.   sed -e "
  522. $prsub
  523. $extrasub
  524. s%@CC@%$CC%g
  525. s%@CPP@%$CPP%g
  526. s%@INSTALL@%$INSTALL%g
  527. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  528. s%@INSTALL_DATA@%$INSTALL_DATA%g
  529. s%@SH@%$SH%g
  530. s%@LIBS@%$LIBS%g
  531. s%@srcdir@%$srcdir%g
  532. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  533. fi; done
  534.  
  535. CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"}
  536. for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then
  537. if test "x$only" != "x" -a "x$only" != "x$file"; then continue; fi
  538. echo creating $file
  539.  
  540. # These sed commands are put into SEDDEFS when defining a macro.
  541. # They are broken into pieces to make the sed script easier to manage.
  542. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  543. # is the cpp macro being defined and VALUE is the value it is being given.
  544. # Each defining turns into a single global substitution command.
  545. #
  546. # SEDd sets the value in "#define NAME VALUE" lines.
  547. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  548. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  549. SEDdC='\3'
  550. SEDdD='@g'
  551. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  552. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  553. SEDuB='\([     ]\)@\1#\2define\3'
  554. SEDuC=' '
  555. SEDuD='\4@g'
  556. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  557. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  558. SEDeB='$@\1#\2define\3'
  559. SEDeC=' '
  560. SEDeD='@g'
  561. rm -f conftest.sed
  562. EOF
  563. # Turn off quoting long enough to insert the sed commands.
  564. rm -f conftest.sh
  565. cat > conftest.sh <<EOF
  566. $SEDDEFS
  567. EOF
  568.  
  569. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  570. # on the size of here documents.
  571.  
  572. # Maximum number of lines to put in a single here document.
  573. maxshlines=9
  574.  
  575. while :
  576. do
  577.   # wc gives bogus results for an empty file on some systems.
  578.   lines=`grep -c . conftest.sh`
  579.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  580.   rm -f conftest.s1 conftest.s2
  581.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  582.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  583.   # Write a limited-size here document to append to conftest.sed.
  584.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  585.   cat conftest.s1 >> config.status
  586.   echo 'CONFEOF' >> config.status
  587.   rm -f conftest.s1 conftest.sh
  588.   mv conftest.s2 conftest.sh
  589. done
  590. rm -f conftest.sh
  591.  
  592. # Now back to your regularly scheduled config.status.
  593. cat >> config.status <<\EOF
  594. # This sed command replaces #undef's with comments.  This is necessary, for
  595. # example, in the case of _POSIX_SOURCE, which is predefined and required
  596. # on some systems where configure will not decide to define it in
  597. # config.h.
  598. cat >> conftest.sed <<\CONFEOF
  599. s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  600. CONFEOF
  601. rm -f conftest.h
  602. # Break up the sed commands because old seds have small limits.
  603. maxsedlines=20
  604. cp $top_srcdir/$file.in conftest.h1
  605. while :
  606. do
  607.   lines=`grep -c . conftest.sed`
  608.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  609.   rm -f conftest.s1 conftest.s2 conftest.h2
  610.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  611.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  612.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  613.   rm -f conftest.s1 conftest.h1 conftest.sed
  614.   mv conftest.h2 conftest.h1
  615.   mv conftest.s2 conftest.sed
  616. done
  617. rm -f conftest.sed conftest.h
  618. echo "/* $file.  Generated automatically by configure.  */" > conftest.h
  619. cat conftest.h1 >> conftest.h
  620. rm -f conftest.h1
  621. if cmp -s $file conftest.h 2>/dev/null; then
  622.   # The file exists and we would not be changing it.
  623.   echo "$file is unchanged"
  624.   rm -f conftest.h
  625. else
  626.   rm -f $file
  627.   mv conftest.h $file
  628. fi
  629. fi; done
  630.  
  631.  
  632.  
  633. exit 0
  634. EOF
  635. chmod +x config.status
  636. test "${no_create}" != yes && ${CONFIG_SHELL-/bin/sh} config.status ${only}
  637.  
  638. exit 0
  639.